From: Rob Church Date: Sun, 3 Dec 2006 04:09:48 +0000 (+0000) Subject: Quote namespace names before plonking them into a regular expression, to give me... X-Git-Tag: 1.31.0-rc.0~55001 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=cd0570b8945132ee01a2247cf51e4bf1fd359c3d;p=lhc%2Fweb%2Fwiklou.git Quote namespace names before plonking them into a regular expression, to give me the warm fuzzies --- diff --git a/includes/Linker.php b/includes/Linker.php index b54c4264a7..f7b5c0aed3 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -931,8 +931,8 @@ class Linker { # format regular and media links - all other wiki formatting # is ignored - $medians = '(?:' . Namespace::getCanonicalName( NS_MEDIA ) . '|'; - $medians .= $wgContLang->getNsText( NS_MEDIA ) . '):'; + $medians = '(?:' . preg_quote( Namespace::getCanonicalName( NS_MEDIA ), '/' ) . '|'; + $medians .= preg_quote( $wgContLang->getNsText( NS_MEDIA ), '/' ) . '):'; while(preg_match('/\[\[(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) { # Handle link renaming [[foo|text]] will show link as "text" if( "" != $match[3] ) {